<?php

/**
 * DebitMemo form base class.
 *
 * @method DebitMemo getObject() Returns the current form's model object
 *
 * @package    erpcrm
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfPropelFormGeneratedTemplate.php 24171 2009-11-19 16:37:50Z Kris.Wallsmith $
 */
abstract class BaseDebitMemoForm extends BaseFormPropel
{
  public function setup()
  {
    $this->setWidgets(array(
      'debit_iden'    => new sfWidgetFormInputHidden(),
      'customer_iden' => new sfWidgetFormPropelChoice(array('model' => 'AccountCustomer', 'add_empty' => false)),
      'debit_type'    => new sfWidgetFormPropelChoice(array('model' => 'ListDocumentTypes', 'add_empty' => false, 'key_method' => 'getTypeid')),
      'debit_number'  => new sfWidgetFormInputText(),
      'remarks'       => new sfWidgetFormTextarea(),
      'invoice_iden'  => new sfWidgetFormPropelChoice(array('model' => 'Invoice', 'add_empty' => false)),
      'amount'        => new sfWidgetFormInputText(),
    ));

    $this->setValidators(array(
      'debit_iden'    => new sfValidatorPropelChoice(array('model' => 'Document', 'column' => 'document_iden', 'required' => false)),
      'customer_iden' => new sfValidatorPropelChoice(array('model' => 'AccountCustomer', 'column' => 'contact_iden')),
      'debit_type'    => new sfValidatorPropelChoice(array('model' => 'ListDocumentTypes', 'column' => 'typeid')),
      'debit_number'  => new sfValidatorString(array('max_length' => 20)),
      'remarks'       => new sfValidatorString(),
      'invoice_iden'  => new sfValidatorPropelChoice(array('model' => 'Invoice', 'column' => 'invoice_iden')),
      'amount'        => new sfValidatorNumber(),
    ));

    $this->widgetSchema->setNameFormat('debit_memo[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'DebitMemo';
  }


}
